home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2000 September / september_2000.iso / intercd / root / ^Linux / cdrtools-1.10 / lib / gethostid.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-30  |  1.4 KB  |  52 lines

  1. /* @(#)gethostid.c    1.13 99/08/30 Copyright 1995 J. Schilling */
  2. #ifndef lint
  3. static    char sccsid[] =
  4.     "@(#)gethostid.c    1.13 99/08/30 Copyright 1995 J. Schilling";
  5. #endif
  6. /*
  7.  *    Copyright (c) 1995 J. Schilling
  8.  */
  9. /*
  10.  * This program is free software; you can redistribute it and/or modify
  11.  * it under the terms of the GNU General Public License as published by
  12.  * the Free Software Foundation; either version 2, or (at your option)
  13.  * any later version.
  14.  *
  15.  * This program is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  * GNU General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU General Public License
  21.  * along with this program; see the file COPYING.  If not, write to
  22.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  */
  24.  
  25. #include <mconfig.h>
  26. #include <standard.h>
  27. #include <stdxlib.h>
  28. #include <utypes.h>
  29. #ifdef    HAVE_SYS_SYSTEMINFO_H
  30. #include <sys/systeminfo.h>
  31. #endif
  32. #include <libport.h>
  33.  
  34. #ifndef    HAVE_GETHOSTID
  35. EXPORT    long    gethostid    __PR((void));
  36. #endif
  37.  
  38.  
  39. #if    !defined(HAVE_GETHOSTID) && defined(SI_HW_SERIAL)
  40.  
  41. EXPORT long
  42. gethostid()
  43. {
  44.     long    id;
  45.  
  46.     char    hbuf[257];
  47.     sysinfo(SI_HW_SERIAL, hbuf, sizeof(hbuf));
  48.     id = atoi(hbuf);
  49.     return (id);
  50. }
  51. #endif
  52.